class Enemy{
  constructor(ctx){
    this.ctx =ctx;
    this.img = new Image();
    this.img.src = 'images/Bomb.jpg';
    //炸弹相关坐标信息
    this.init = {
      x: (this.ctx.canvas.width - 80) * Math.random(),
      y: -100,
      w: 60,
      h: 50
    },
      //控制当前炸弹是否再可视区域
      this.status = true;
  }
  draw(){
    //控制炸弹移动
    this.init.y += 3;
    if (this.init.y > this.ctx.canvas.height) {
      this.status = false;
    }
    this.ctx.drawImage(this.img, this.init.x, this.init.y, this.init.w, this.init.h)
  }
}
export default Enemy;